{template 'web/_header'}
<ul class="nav nav-tabs">
    <li class=""><a href="{php echo $this->createPluginWebUrl('express/express')}">快递预处理</a></li>
    <li class="active"><a href="{php echo $this->createPluginWebUrl('express/shipment')}">批量发货</a></li>
</ul>

<div class="panel panel-info">
    <div class="panel-heading">订单筛选</div>
    <div class="panel-body">

        <form action="./index.php" method="get" class="form-horizontal" role="form">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="ewei_shop" />
            <input type="hidden" name="do" value="plugin" />
            <input type="hidden" name="p"  value="express" />
            <input type="hidden" name="op" value="lists" />
            <input type="hidden" name="method" value="shipment" />
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label" for="dispatchid"><span style="color:red">*</span> 配送快递</label>
                <div class="col-xs-12 col-sm-8 col-lg-9">
                    <select class="form-control" id="dispatchid" name="dispatchid">
                        {loop $dispatchLists $list}
                        <option value="{$list['id']}" {if $_GPC['dispatchid'] == $list['id']}selected="selected" {/if} >{$list['dispatchname']}</option>
                        {/loop}
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label" for="ordersn">订单编号</label>
                <div class="col-xs-12 col-sm-8 col-lg-9">
                    <input class="form-control" name="ordersn" id="ordersn" type="text" value="{$_GPC['ordersn']}">
                </div>
            </div>

            <div class="form-group">
                <div class="col-lg-11  col-md-offset-1">
                    <div class='input-group'>
                        <div class='input-group-addon'>下单时间
                            <label class='radio-inline' style='margin-top:-7px;'>
                                <input type='radio' value='0' name='createtime' {if $_GPC['createtime']=='0'}checked{/if}>不搜索
                            </label>
                            <label class='radio-inline'  style='margin-top:-7px;'>
                                <input type='radio' value='1' name='createtime' {if $_GPC['createtime']=='1'}checked{/if}>搜索
                            </label>
                        </div>
                        {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-lg-11  col-md-offset-1">
                    <div class='input-group'>
                        <div class='input-group-addon'>支付时间
                            <label class='radio-inline' style='margin-top:-7px;'>
                                <input type='radio' value='0' name='paytime' {if $_GPC['paytime']=='0'}checked{/if}>不搜索
                            </label>
                            <label class='radio-inline'  style='margin-top:-7px;'>
                                <input type='radio' value='1' name='paytime' {if $_GPC['paytime']=='1'}checked{/if}>搜索
                            </label>
                        </div>
                        {php echo tpl_form_field_daterange('ptime', array('starttime'=>date('Y-m-d H:i', $pstarttime),'endtime'=>date('Y-m-d H:i', $pendtime)),true);}
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
                <div class="col-xs-12 col-sm-8 col-lg-6">
                    <select name="status" class='form-control'>
                        <option value="1" {if $_GPC['status'] != '1'} selected{/if}>待发货</option>
                        <option value="2" {if $_GPC['status'] == '2'} selected{/if}>已发货</option>
                    </select>
                </div>

                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    <input type="hidden" name="token" value="{$_W['token']}" />
                    {if $_GPC['status'] == 1}
                    <button class="btn btn-info" name="send" value="1" formtarget="_blank">填充订单</button>
                    {/if}
                    {if $_GPC['status'] >= 2}
                    <button class="btn btn-warning" name="export" value="1" formtarget="_blank">导出EXCEL</button>
                    {/if}
                </div>
            </div>

        </form>
    </div>
</div>

{if !empty($orderLists)}
<div class="panel panel-default">
    <div class="panel-heading">订单结果</div>

    <div class="panel-body">
        <table class="table">
            <thead>
                <tr>
                    <th>订单编号</th>
                    <th>创建时间</th>
                    <th>发货时间</th>
                    <th>支付时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            {loop $orderLists $list}
                <tr>
                    <td><a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'keyword' => $list['ordersn'] ))}" target="_blank">{$list['ordersn']}</a></td>
                    <td>{php echo date('Y-m-d H:i:s', $list['createtime'])}</td>
                    {if !empty($list['sendtime'])}
                    <td>{php echo date('Y-m-d H:i:s', $list['sendtime'])}</td>
                    {else}
                    <td>待发货</td>
                    {/if}
                    <td>{php echo date('Y-m-d H:i:s', $list['paytime'])}</td>
                    <td>
                        {if $_GPC['status'] == 1}
                        <a class="btn btn-default" title="发货" href="javascript:;"><i class="fa fa-send"></i></a>
                        {else}
                        <a class="btn btn-default" title="取消发货" href="javascript:;"><i class="fa fa-flash"></i></a>
                        {/if}
                    </td>
                </tr>
            {/loop}
            </tbody>
        </table>

    </div>

    <div class="panel-footer">
        {php echo $pagination}
    </div>
</div>
{/if}

{template 'common/footer'}